[BETA] Update Toppie Campaign
curl --request PATCH \
--url https://api.topsort.com/public/v1/toppie/campaigns/{campaign_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"budget": 10000000000,
"targets": {
"add": [
"<string>"
],
"remove": [
"<string>"
]
},
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"targetRoas": 10.25,
"isActive": true
}
'import requests
url = "https://api.topsort.com/public/v1/toppie/campaigns/{campaign_id}"
payload = {
"name": "<string>",
"budget": 10000000000,
"targets": {
"add": ["<string>"],
"remove": ["<string>"]
},
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"targetRoas": 10.25,
"isActive": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
budget: 10000000000,
targets: {add: ['<string>'], remove: ['<string>']},
startDate: '2023-11-07T05:31:56Z',
endDate: '2023-11-07T05:31:56Z',
targetRoas: 10.25,
isActive: true
})
};
fetch('https://api.topsort.com/public/v1/toppie/campaigns/{campaign_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.topsort.com/public/v1/toppie/campaigns/{campaign_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'budget' => 10000000000,
'targets' => [
'add' => [
'<string>'
],
'remove' => [
'<string>'
]
],
'startDate' => '2023-11-07T05:31:56Z',
'endDate' => '2023-11-07T05:31:56Z',
'targetRoas' => 10.25,
'isActive' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.topsort.com/public/v1/toppie/campaigns/{campaign_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"budget\": 10000000000,\n \"targets\": {\n \"add\": [\n \"<string>\"\n ],\n \"remove\": [\n \"<string>\"\n ]\n },\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"targetRoas\": 10.25,\n \"isActive\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.topsort.com/public/v1/toppie/campaigns/{campaign_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"budget\": 10000000000,\n \"targets\": {\n \"add\": [\n \"<string>\"\n ],\n \"remove\": [\n \"<string>\"\n ]\n },\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"targetRoas\": 10.25,\n \"isActive\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/public/v1/toppie/campaigns/{campaign_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"budget\": 10000000000,\n \"targets\": {\n \"add\": [\n \"<string>\"\n ],\n \"remove\": [\n \"<string>\"\n ]\n },\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"targetRoas\": 10.25,\n \"isActive\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"adFormat": "banner",
"chargeType": "CPM",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"budget": 123,
"budgetPeriod": "daily",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"targetRoas": 10.25,
"currencyCode": "USD",
"isActive": true,
"createdAt": "2023-11-07T05:31:56Z",
"bidCount": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Toppie API
[BETA] Update Toppie Campaign
Update an agency campaign with the provided details.
PATCH
/
public
/
v1
/
toppie
/
campaigns
/
{campaign_id}
[BETA] Update Toppie Campaign
curl --request PATCH \
--url https://api.topsort.com/public/v1/toppie/campaigns/{campaign_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"budget": 10000000000,
"targets": {
"add": [
"<string>"
],
"remove": [
"<string>"
]
},
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"targetRoas": 10.25,
"isActive": true
}
'import requests
url = "https://api.topsort.com/public/v1/toppie/campaigns/{campaign_id}"
payload = {
"name": "<string>",
"budget": 10000000000,
"targets": {
"add": ["<string>"],
"remove": ["<string>"]
},
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"targetRoas": 10.25,
"isActive": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
budget: 10000000000,
targets: {add: ['<string>'], remove: ['<string>']},
startDate: '2023-11-07T05:31:56Z',
endDate: '2023-11-07T05:31:56Z',
targetRoas: 10.25,
isActive: true
})
};
fetch('https://api.topsort.com/public/v1/toppie/campaigns/{campaign_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.topsort.com/public/v1/toppie/campaigns/{campaign_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'budget' => 10000000000,
'targets' => [
'add' => [
'<string>'
],
'remove' => [
'<string>'
]
],
'startDate' => '2023-11-07T05:31:56Z',
'endDate' => '2023-11-07T05:31:56Z',
'targetRoas' => 10.25,
'isActive' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.topsort.com/public/v1/toppie/campaigns/{campaign_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"budget\": 10000000000,\n \"targets\": {\n \"add\": [\n \"<string>\"\n ],\n \"remove\": [\n \"<string>\"\n ]\n },\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"targetRoas\": 10.25,\n \"isActive\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.topsort.com/public/v1/toppie/campaigns/{campaign_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"budget\": 10000000000,\n \"targets\": {\n \"add\": [\n \"<string>\"\n ],\n \"remove\": [\n \"<string>\"\n ]\n },\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"targetRoas\": 10.25,\n \"isActive\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/public/v1/toppie/campaigns/{campaign_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"budget\": 10000000000,\n \"targets\": {\n \"add\": [\n \"<string>\"\n ],\n \"remove\": [\n \"<string>\"\n ]\n },\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"endDate\": \"2023-11-07T05:31:56Z\",\n \"targetRoas\": 10.25,\n \"isActive\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"adFormat": "banner",
"chargeType": "CPM",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"budget": 123,
"budgetPeriod": "daily",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"targetRoas": 10.25,
"currencyCode": "USD",
"isActive": true,
"createdAt": "2023-11-07T05:31:56Z",
"bidCount": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Autorizações
Corpo
application/json
Agency campaign fields to be updated
Date when to start the campaign, specified in RFC 3339, if not set that campaign will start immediately after the campaign creation. Must include the Timezone definition.
Date when to stop the campaign, specified in RFC 3339, if not set the campaign will never stop. This date must be greater than the start date and must be in the future. Must include the Timezone definition.
Esta página foi útil?